<%--
  Created by IntelliJ IDEA.
  User: 刘邓
  Date: 2023-06-02
  Time: 10:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加用户</title>
    <style>
        .container {
            background-color: #fff;
            border-radius: 10px;
            box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
            position: relative;
            overflow: hidden;
            width: 768px;
            max-width: 100%;
            min-height: 480px;
            margin:0 auto;
        }
        .container div{
            margin-top: 20px;
            margin-left: 40%;
        }

        input {
            background-color: #eee;
            border: none;
            padding: 12px 15px;
            margin: 8px 10px;
        }
    </style>
</head>
<body>
<form action="/home/addUserOutcome.jsp" class="container">
  <div>用户名:<input type="text" name="username" id="r_name"></div>
  <div>密码:<input type="password" name="password" id="r_pwd"></div>
   <div> 再次输入密码:<input type="password" name="repassword" id="r_rpwd"></div>
  <div style="padding-left: 30px"><input type="submit" value="添加" id="toRegister"></div>
</form>
</body>
<script>
    let toRegister = document.getElementById("toRegister");
    toRegister.addEventListener("click",()=>{
        let name_str=document.getElementById("r_name").value;
        if(name_str===null||name_str===""){
            alert("请输入用户名");
            location.reload();
            return;
        }
        let pwd_str=document.getElementById("r_pwd").value;
        if(pwd_str===null||pwd_str===""){
            alert("请输入密码");
            location.reload();
            return;
        }
        let rpwd_str=document.getElementById("r_rpwd").value;
        if(rpwd_str===null||rpwd_str===""){
            alert("请输入确认密码");
            location.reload();
            return;
        }
        if(rpwd_str !== pwd_str){
            alert("两次输入密码不一致");
            location.reload();
            return;
        }
    })
</script>
</html>
